package com.pro.service.imple;

import com.pro.mapper.JsCourseCommentMapper;
import com.pro.pojo.JsComment;
import com.pro.pojo.JsCourse;
import com.pro.service.JsCourseCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ClassName:JsCourseCommentServiceImple
 * Package:com.pro.service.imple
 * Description:
 *
 * @Date:2022/1/15 14:08
 * @Author: XJR
 */
@Service
public class JsCourseCommentServiceImple implements JsCourseCommentService {

    @Autowired
    private JsCourseCommentMapper mapper;
    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/1/15
     * @Content:按钮中的评论数量
     */
    public Integer BeforeCountAll(Integer type,String status){
        Integer integer = mapper.BeforeCountAll(type, status);
        return integer;
    };

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/1/16
     * @Content:table中的数据
     */

    public Integer BeforeCountToday(Integer type,String status,String commentDate){
        Integer integer = mapper.BeforeCountToday(type, status, commentDate);
        return integer;
    };

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/1/15
     * @Content:layui表格中的数据
     */
    public List<JsComment> selectBeforeTable(Integer type, String status,Integer limit,Integer page){
        page = (page-1)*limit;
        List<JsComment> jsComments = mapper.selectBeforeTable(type, status, limit, page);
        return jsComments;
    };

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/1/16
     * @Content:前台查看课程详情
     */
    public JsCourse selectBeforeJsCourse(Integer type, Integer id){
        JsCourse jsCourse = mapper.selectBeforeJsCourse(type, id);
        return jsCourse;
    };

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/1/17
     * @Content:查看前端人员的课程评论
     */
    public List<JsComment> selectBeforeCourseCommentById(Integer commodityId,Integer type){
        List<JsComment> jsCourses = mapper.selectBeforeCourseCommentById(commodityId, type);
        return jsCourses;
    };

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/1/17
     * @Content:管理人员按钮中的数据
     */
    public Integer UserCountAll(Integer type,String status){
        Integer integer = mapper.UserCountAll(type, status);
        return integer;
    };

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/1/17
     * @Content:tbale中的数据
     */

    public Integer UserCountToday(Integer type,String status,String commentDate){
        Integer integer = mapper.UserCountToday(type, status, commentDate);
        return integer;
    };

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/1/17
     * @Content:layuiTable中的数据
     */
    public List<JsComment> selectUserTable(Integer type,String status,Integer limit,Integer page){
        page = (page-1)*limit;
        List<JsComment> jsComments = mapper.selectUserTable(type, status, limit, page);
        return jsComments;
    };

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/1/16
     * @Content:后台查看课程详情
     */
    public JsCourse selectUserJsCourse(Integer type,Integer id){;
        JsCourse jsCourse = mapper.selectUserJsCourse(type,id);
        return jsCourse;
    };

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/1/17
     * @Content:根据id查询后台人员评论的课程详情
     */
    public List<JsComment> selectUserCourseCommentById(Integer commodityId,Integer type){
        List<JsComment> jsComments = mapper.selectUserCourseCommentById(commodityId, type);
        return jsComments;
    };
}
